let express = require('express');
let router = express.Router();

// 引入用户模块的controller
let userController = require('../controller/userController');

router.get('/register', (req, res) => {
    res.render('./user/register');
});
// 服务器监听用户发送过来的注册新用户请求/adduser
router.post('/adduser', userController.handlePostUser);

// 添加login页面的路由
router.get('/login', (req, res) => {
    res.render('./user/login');
});
// 处理登录的post请求
router.post('/login', userController.handleLogin);
// 处理注销登录
router.get('/logout', userController.handleLogout);

module.exports = router;